package priv.wangy.micro.common.exception;


import priv.wangy.micro.common.po.http.rspn.code.SysErrorEnum;
import priv.wangy.micro.common.utils.JsonUtil;

/**
 * 异常：对象未找到
 * 适用于未在数据库或缓存中查询到目标对象
 *
 * @author zhangjq
 * @since 2023-10-24
 */
public class ObjectNotFoundException extends ServiceException {

    public ObjectNotFoundException() {
        super(SysErrorEnum.OBJECT_NOT_FOUND);
    }

    public ObjectNotFoundException(String message) {
        super(message, SysErrorEnum.OBJECT_NOT_FOUND);
    }

    public ObjectNotFoundException(String name, Object criteria) {
        super(String.format("未找到目标[%s]，查询条件：{%s}", name, JsonUtil.writeJson(criteria)), SysErrorEnum.OBJECT_NOT_FOUND);
    }
}
